var recordHigh = localStorage.getItem("record") || 0

//initialize the get-ready curtain and start the game
//param: the game loop function that carry the main logic
const init = function(game) {
  
	document.querySelector(".highest>span").textContent = recordHigh
    var curtain = document.createElement('div')
    curtain.classList.add('curtain')
	document.querySelector('body').appendChild(curtain)

	var start = 3
	var countDown = setInterval(function () {
		curtain.textContent = start--
	}, 1000)

	setTimeout(function () {
		clearInterval(countDown)
		curtain.remove()
		game()
	}, 4000)
}

//create a new element with given class names
//param 1: the name of the tag element to be created. type of string
//param 2: a string contains class names separated by white space
//returned: the created element 
const createElementWithClassAttribute = function(tagName,classNames){
	return Object.assign(document.createElement(tagName),{className:classNames})
}